/**
 * 作者：靳沛鑫
 * 创建日期：2019-10-30
 * 邮件：1677401802@qq.com
 * 文件说明：国家项目-项目列表
 */
//引入services
//import * as projNationalService from "../../services/projCountry/projNationalService";

export default {
	namespace: 'biaodan',
	state: {
		dataList:[],
	},
	reducers: {
		//存值到this.props
		save(state, action) {
			return { ...state, ...action.payload };
		},
	},
	effects: {
		* init({ }, { select, call, put }) {
			//select 取值
			//const { dataList } = yield select(state => state.biaodan);
			//call 调用services 走接口
			//const data = yield call(projNationalService.authSet, { arg_staff_id: staff_id })

			//put 调用方法 这里是给dataList赋值
			yield put({
				type: 'save',
				payload: {
					dataList: ['1','2','3']
				}
			})
			//调用jump方法
			yield put({
				type: 'jump'
			})
		},
		* jump({ }, { select, call, put }) {
			console.log('jump')
		},
		* holdThis({ changeMake }, { select, call, put }) {
			console.log(changeMake)
		}
	},
	//全局监听
	
	subscriptions: {
		setup({ dispatch, history }) {
			return history.listen(({ pathname, search }) => {
				if (pathname === '/biaodan') {
					dispatch({ type: 'init' });

				}
			});
		},
	}
}
